<?php
namespace app\api\validate;

use think\Validate;

/**
 * Class CarillegalValidate
 * @package app\api\validate
 * @author zhenHong~
 */
class CarillegalValidate extends Validate{
//'engineno',

    protected $rule = [
        'engineno' => ['require'],
        'classno' => ['require','regex'=> '/^[\da-zA-Z]{17}$/'],
        'hphm' => ['require'],
        'u_id' => ['require','regex' => '/^[+]{0,1}(\d+)$/'],
        'listNum' => ['require','number'],
        'pagenum' => ['require','number'],
        'id' => ['require','regex' => '/^[+]{0,1}(\d+)$/']
    ];

    protected $message = [
        'engineno' => '发动机号格式错误',
        'classno' => '车架号格式错误',
        'hphm' => '	车牌号格式错误',
        'u_id' => '用户id错误',
        'listNum' => '每页数量参数错误',
        'pagenum' => '分页参数错误',
        'id' => '违章记录id参数错误'
    ];
    protected $scene = [
        //通过用户 id 查询 车牌 车架号 发动机号 用来违章查询
        'userIllegalInfo' => ['u_id'],
        //车辆违章查询
        'illegal' => ['hphm','classno','u_id'],
        //查询违章记录列表
        'illegalList' => ['listNum','pagenum'],
        //违章记录详情
        'illegalInfo' => ['id']
    ];

}